﻿Namespace DotNetNuke.Modules.ActiveForums
    Partial Public Class admin_templates_new
        Inherits ActiveAdminBase

        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        End Sub

        Private Sub agTemplates_Callback(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.CallBackEventArgs) Handles agTemplates.Callback
            Dim PageIndex As Integer = CInt(e.Parameters(0))
            Dim PageSize As Integer = CInt(e.Parameters(1))
            Dim RowIndex As Integer = 0
            If PageIndex = 0 Then
                RowIndex = 0
            Else
                RowIndex = (((PageIndex + 1) * PageSize) - PageSize)
            End If
            agTemplates.Datasource = DataProvider.Instance.Templates_List(PortalId, ModuleId, 0, RowIndex, PageSize)
            agTemplates.Refresh(e.Output)
        End Sub

        Private Sub agTemplates_ItemBound(ByVal sender As Object, ByVal e As Modules.ActiveForums.Controls.ItemBoundEventArgs) Handles agTemplates.ItemBound
            Dim sValue As String = String.Empty
            Try
                sValue = GetSharedResource("[RESX:" & Convert.ToString([Enum].Parse(GetType(Templates.TemplateTypes), e.Item(1).ToString())) & "]")
            Catch ex As Exception
                sValue = e.Item(1).ToString
            End Try
            e.Item(1) = sValue
        End Sub
    End Class
End Namespace